package com.smarttourism.service.impl;

import java.util.List;
import com.smarttourism.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smarttourism.mapper.SpendMapper;
import com.smarttourism.domain.Spend;
import com.smarttourism.service.ISpendService;

/**
 * 消费记录Service业务层处理
 * 
 * @author smarttourism
 * @date 2024-10-23
 */
@Service
public class SpendServiceImpl implements ISpendService 
{
    @Autowired
    private SpendMapper spendMapper;

    /**
     * 查询消费记录
     * 
     * @param id 消费记录主键
     * @return 消费记录
     */
    @Override
    public Spend selectSpendById(Long id)
    {
        return spendMapper.selectSpendById(id);
    }

    /**
     * 查询消费记录列表
     * 
     * @param spend 消费记录
     * @return 消费记录
     */
    @Override
    public List<Spend> selectSpendList(Spend spend)
    {
        return spendMapper.selectSpendList(spend);
    }

    /**
     * 新增消费记录
     * 
     * @param spend 消费记录
     * @return 结果
     */
    @Override
    public int insertSpend(Spend spend)
    {
        spend.setCreateTime(DateUtils.getNowDate());
        return spendMapper.insertSpend(spend);
    }

    /**
     * 修改消费记录
     * 
     * @param spend 消费记录
     * @return 结果
     */
    @Override
    public int updateSpend(Spend spend)
    {
        return spendMapper.updateSpend(spend);
    }

    /**
     * 批量删除消费记录
     * 
     * @param ids 需要删除的消费记录主键
     * @return 结果
     */
    @Override
    public int deleteSpendByIds(Long[] ids)
    {
        return spendMapper.deleteSpendByIds(ids);
    }

    /**
     * 删除消费记录信息
     * 
     * @param id 消费记录主键
     * @return 结果
     */
    @Override
    public int deleteSpendById(Long id)
    {
        return spendMapper.deleteSpendById(id);
    }
}
